<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>会员登录页面</title>
    <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/">
    <link type="text/css" rel="stylesheet" href="static/css/style.css">
</head>
<body>
<div id="login_header">
    <img class="logo_img" alt="" src="static/img/logo.gif" width="230px" height="80px">
</div>

<div class="login_banner">

    <div id="l_content">
        <span class="login_word">欢迎登录</span>
    </div>

<%--        ${cookie.username.name} = ${cookie.username.value}--%>
<%--        ${cookie.password.name} = ${cookie.password.value}--%>
    <!--如果username和password不等于空,就把cookie中的用户名与密码发送给服务器 -->
    <c:if test="${!empty cookie.username && !empty cookie.password}">
        <jsp:forward page="/UserServlet?method=login">
            <jsp:param name="username" value="${cookie.username.value}"/>
            <jsp:param name="password" value="${cookie.password.value}"/>
        </jsp:forward>
    </c:if>


    <div id="content">
        <div class="login_form">
            <div class="login_box">
                <div class="tit">
                    <h1>会员</h1>
                    <a href="pages/user/regist.jsp">立即注册</a>
                </div>
                <div class="msg_cont">
                    <b></b>
                    <span class="errorMsg">
									<c:out value="${sessionScope.msg}" default="请输入用户名和密码"></c:out>
                    </span>
                </div>
                <div class="form">
                    <form action="UserServlet?method=login" method="post">
                        <label>用户名称：</label>
                        <input value="${sessionScope.username}" class="itxt" type="text" placeholder="请输入用户名"
                               autocomplete="off" tabindex="1"
                               name="username"/>
                        <br/>
                        <br/>
                        <label>用户密码：</label>
                        <input value="${sessionScope.password}" class="itxt" type="password" placeholder="请输入密码"
                               autocomplete="off" tabindex="1"
                               name="password"/>
                        <br/>
                        <br/>
                        <input type="submit" value="登录" id="sub_btn"/>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 用完这三个参数 .我把它们从session会话会用域中删除掉-->
<c:remove scope="session" var="msg"></c:remove>
<c:remove scope="session" var="username"></c:remove>
<c:remove scope="session" var="password"></c:remove>
<div id="bottom">
			<span>
				网上书城.Copyright &copy;2020
			</span>
</div>
</body>
</html>